package lovo.practice_7_14;

import lovo.Util.Util;

import javax.swing.*;
import java.awt.*;
import java.security.PublicKey;


public class J189_7_14 extends JFrame {
    private LoginPanel loginPanel = new LoginPanel(this);
    private MunePanel munePanel = new MunePanel(this);
    private SavePanel savePanel = new SavePanel(this);
    private GetPanel getPanel = new GetPanel(this);
    private FindPanel findPanel = new FindPanel(this);

    private Image ImageTitle = Util.getimages("/Images/微信图片_20220705124452.jpg");
    private Image ImageBack = Util.getimages("/Images/background.jpg");

    private CardLayout cardLayout = new CardLayout();

    public J189_7_14() {
        //1 设置背景图
        this.setContentPane(new JPanel() {
            @Override
            protected void paintComponent(Graphics g) {
                super.paintComponent(g);
                g.drawImage(ImageBack, 0, 0, 1024, 768, this);
            }
        });

        this.setLayout(cardLayout);
        //           2 设置登录按钮
        this.add("login", loginPanel);
        //               3 设置菜单card
        this.add("mune", munePanel);
        //4 存钱card
        this.add("save", savePanel);
        //5 取钱
        this.add("get", getPanel);
        // 6 查询
        this.add("find", findPanel);

        //0 初始化

        this.setSize(1024, 768);
        this.setTitle("银行管理系统");
        this.setLocationRelativeTo(null);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setIconImage(ImageTitle);
        this.setVisible(true);


    }

    public void switchPanel(String name) {
        cardLayout.show(this.getContentPane(), name);
    }

    public static void main(String[] args) {
        new J189_7_14();
    }
}
